Ext.define('DragonApp.view.operalog.Controller', {
    extend: 'Ext.app.ViewController',

    alias: 'controller.operalog',

    onSubmitClick: function(button, e, options) {

        var form = Ext.ComponentQuery.query('operalogform')[0];
        var getform = form.getForm();

        if (!getform.isValid()) return;

        var formValue = getform.getValues();

        var grid = Ext.ComponentQuery.query('operaloggrid')[0];
        var store = grid.getStore();

        //数据仓库根据查询附加参数加载
        store.load({
            params: formValue,
            scope: this,
            callback: function(records, operation, success) {

                if (success == false) {
                    DragonApp.util.Msg.showToast('提示:数据加载请求失败');
                    store.removeAll();
                } else if (success == true) {
                    if ("user-not-exist" == operation._response.type) {
                        DragonApp.util.Msg.showToast(operation._response.msg);
                        store.removeAll();
                    }
                }
            }
        });
    }
});